package com.example.shop_2210.database

import android.content.Context
import androidx.room.Room

/**
 * 数据库工具类
 */
class AppDbUtils {
    companion object{
        private lateinit var appDataBase: AppDataBase
        //初始化数据库
        fun init(context: Context){
            appDataBase = Room.databaseBuilder(context,AppDataBase::class.java,"2210.db")
                .allowMainThreadQueries()
                .build()
        }
        //对外暴露数据库，让外部可以访问
        fun getDB() = appDataBase
    }
}